Fix 2 VMX time-related bugs:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 23 Mar 2006 13:44:51 +0000 (14:44 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 23 Mar 2006 13:44:51 +0000 (14:44 +0100)
 1) bogomips=0 or a very huge number after booting ia32/ia32e vmx
 2) Repeated keys show in Xwindow terminal after one key is pressed

Signed-off-by: Xiaowei Yang <xiaowei.yang@intel.com>
xen/arch/x86/hvm/vmx/io.c
xen/arch/x86/hvm/vmx/vmx.c

index 1a862894ae523fc193d217b1a36f21674edb3258..18c793f843c7cdfcaaf9d19fc54100647375c693 100644 (file)
@@ -86,7 +86,7 @@ interrupt_post_injection(struct vcpu * v, int vector, int type)
         }
         vpit->inject_point = NOW();
 
-        vpit->last_pit_gtime += vpit->period;
+        vpit->last_pit_gtime += vpit->period_cycles;
         set_guest_time(v, vpit->last_pit_gtime);
     }
 
@@ -206,8 +206,11 @@ void vmx_do_resume(struct vcpu *v)
     vmx_stts();
 
     /* pick up the elapsed PIT ticks and re-enable pit_timer */
-    if ( vpit->first_injected) {
-        set_guest_time(v, v->domain->arch.hvm_domain.guest_time);
+    if ( vpit->first_injected ) {
+        if ( v->domain->arch.hvm_domain.guest_time ) {
+            set_guest_time(v, v->domain->arch.hvm_domain.guest_time);
+            v->domain->arch.hvm_domain.guest_time = 0;
+        }
         pickup_deactive_ticks(vpit);
     }
 
index 0235d066f929fcf5a38643fb70a0d7a282118611..fcca96efdb7193b082db00c2226b9ccd9f0c1a0f 100644 (file)
@@ -358,9 +358,10 @@ static void vmx_freeze_time(struct vcpu *v)
 {
     struct hvm_virpit *vpit = &v->domain->arch.hvm_domain.vpit;
     
-    v->domain->arch.hvm_domain.guest_time = get_guest_time(v);
-    if ( vpit->first_injected )
+    if ( vpit->first_injected && !v->domain->arch.hvm_domain.guest_time ) {
+        v->domain->arch.hvm_domain.guest_time = get_guest_time(v);
         stop_timer(&(vpit->pit_timer));
+    }
 }
 
 static void vmx_ctxt_switch_from(struct vcpu *v)